<%--
  Created by IntelliJ IDEA.
  User: 佟强
  Date: 2024-07-22
  Time: 10:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <jsp:include page="../Header.jsp"/>
    <link href="../style/hplus/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <script src="../style/hplus/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="../script/sendTaskJs.js"></script>
    <script src="../script/t6freight.js"></script>
    <title>货代询价</title>
</head>
<body class="gray-bg">
<input type="hidden" id="HiddataIds" value="">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Style -->
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="btn-group " style="width: 100%" id="toolbar">
                <div class="col-sm-6">
                    <div class="form-group form-search">
                        <label class="col-sm-3 control-label">公司名称：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="querySeachName" name="querySeachName"
                                   placeholder="请输入公司名称">
                        </div>
                        <label class="col-sm-3 control-label">询价时间：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="queryBeginSeachDate" name="queryBeginSeachDate" placeholder="开始时间">
                            <input type="text" class="form-control" id="queryEndSeachDate" name="queryEndSeachDate" placeholder="结束时间">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <button type="button" class="btn btn-info" id="bt-serach" onclick="table.queryData('inquiry')">
                        <i class="fa fa-search"></i>&nbsp;查询
                    </button>
                    <button type="button" class="btn btn-success" id="bt-add" onclick="com.clearFormItem();" data-toggle="modal" data-target="#modal-form" name="add">
                        <i class="fa fa-plus"></i>&nbsp;新增
                    </button>
                    <button type="button" class="btn btn-primary" disabled id="bt-complate" onclick="com.clearFormItem()" data-toggle="modal" data-target="#modal-complate" name="complate">
                        <i class="fa fa-check"></i>完成
                    </button>
                </div>
            </div>
            <table id="table-data"></table>
        </div>
    </div>
    <!-- End Panel Style -->
</div>

<!-- 新增询价弹窗 -->
<div class="modal inmodal" data-backdrop="static" id="modal-form" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-body">
                <div class="row">
                    <h3>询价咨询表单</h3>
                    <form class="form-horizontal m-t" id="myForm">
                        <input type="hidden" id="id" name="id" value="">
                        <input type="hidden" id="formStatus" name="formStatus" value="">
                     <input type="hidden" id="hidFromItem" name="hidFromItem" value="">
                    </form>
                </div>
            </div>
            <div class="modal-footer">
                <!-- 这里绑定 location.reload() 用于刷新当前页面，是为了实时更新已读和未读状态，实际上，监听到执行人点击编辑，
                     后台数据就已经更改已读状态了，但是前端需要手动刷新 -->
<%--                <button type="button" class="btn btn-white" onclick="location.reload()" name="bt-close" data-dismiss="modal">关闭</button>--%>
                <button type="button" class="btn btn-white" name="bt-close" data-dismiss="modal">关闭</button>
<%--                <button type="button" class="btn btn-primary" onclick="opt.saveDatas(this,'inquiry'); location.reload()">保存</button>--%>
                <button type="button" class="btn btn-primary" onclick="opt.saveDatas(this,'inquiry')">保存</button>
            </div>
        </div>
    </div>
</div>

<%
    double ranNum = Math.random() * 1000;
%>

<script type="text/javascript" src="../script/treeJs.js?v=<%=ranNum%>"></script>
<link rel="stylesheet" type="text/css" media="all" href="../style/ztree/css/zTreeStyle.css"/>
<link rel="stylesheet" type="text/css" media="all" href="../style/ztree/css/treeSelect.css"/>
<script src="../style/ztree/js/jquery.ztree.all.min.js"></script>
<!--treeSelect-->
<script src="../style/ztree/js/treeSelect.js?v=<%=ranNum%>"></script>
<script src="../style/hplus/js/plugins/chosen/chosen.jquery.js"></script>

<script type="text/javascript" src="../script/tableJs.js?v=<%=ranNum%>"></script>
<script type="text/javascript">
    $(function () {
        $('#bt-add').click(function (){
        });
        fComfig.loadRFormList("inquiry");
        // 获取当前时间
        $('#modal-form').on('shown.bs.modal', function (e) {
            let usersCookie = $.cookie("users");
            let users = JSON.parse(usersCookie);
            console.log(users.name)
            console.log(users)
            if (users.name == "王冬惠" || users.name == "王晓焕" || users.name == "超级管理员" || users.name == "岳佳宁") {
                $("#logisticsprice, #actualprice, #forwarder").attr('type', 'text')

            } else {
                $("#logisticsprice, #actualprice, #forwarder").attr('type', 'hidden')
            }
            console.log(users.name == "王冬惠" || users.name == "王晓焕" || users.name == "超级管理员" || users.name == "岳佳宁");
            if($("#sales").val().length == 0){
                var currentdate = sendT.getCurrentT()
                $("#inquirydate").val(currentdate);
                $("#sales").val(users.name);
                $("#t6price").val(0);
            }
            // 是为了控制当报关和双清为否时禁用状态的更新
            $("#liquidation").val() == 1 ? $("#liquidationprice").prop('disabled', true) : $("#liquidationprice").prop('disabled', false);
            $("#goodsdeclare").val() == 1 ? $("#goodsdeclareprice").prop('disabled', true) : $("#goodsdeclareprice").prop('disabled', false);
            $("#liquidation").change(function () {
                var isDisabled = $(this).val() == 1;
                $("#liquidationprice").prop('disabled', isDisabled)
            })
            $("#goodsdeclare").change(function () {
                var isDisabled = $(this).val() == 1;
                $("#goodsdeclareprice").prop('disabled', isDisabled)
            })
            $("#company").on('blur', function (event){
                console.log($("#company").val())
            })
        });
        $("#myForm").validate();
        //  设置必填提示
        $("#myForm label[l='spot']").prepend("<span style='color: red'>*</span>");
        table.loadData('#table-data', 'inquiry'); // table.loadData('#table-data', 'orders'); // table tag element id , dataType
    });
</script>
</body>
</html>
